import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:getwidget/colors/gf_color.dart';
import 'package:getwidget/components/progress_bar/gf_progress_bar.dart';
import 'package:getwidget/types/gf_progress_type.dart';

import '../controllers/gfprogressbar_controller.dart';

class GfprogressbarView extends GetView<GfprogressbarController> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('进度条'),
        centerTitle: true,
      ),
      body: Container(
        margin: EdgeInsets.all(10),
        child: ListView(
          children: [
            SizedBox(height: 10),
            GFProgressBar(
              percentage: 0.9,
              backgroundColor : Colors.black26,
              progressBarColor: GFColors.DANGER
            ),
            SizedBox(height: 60),

            GFProgressBar(
              percentage: 0.9,
              width: 100,
              radius: 90,
              circleWidth: 15,
              type: GFProgressType.circular,
              backgroundColor : Colors.black26,
              progressBarColor: GFColors.INFO,
              animation: true,
              animationDuration: 1000,
            ),
            SizedBox(height: 60),

            GFProgressBar(
              percentage: 0.66,
              lineHeight: 20,
              child: const Padding(
                padding: EdgeInsets.only(right: 5),
                child: Text(
                  '66%', 
                  textAlign: TextAlign.end,
                  style: TextStyle(
                    fontSize: 16, 
                    color: Colors.white
                  ),
                ),
              ),
              backgroundColor: Colors.black26,
              progressBarColor: GFColors.SUCCESS,
              animation: true,
              animationDuration: 1000,
              // linearGradient: LinearGradient(
              //   colors: [Color(0xFF9B9BEE), Color(0xFF5858F1)],
              //   // 渐变从左到右
              //   begin: Alignment.centerLeft,
              //   end: Alignment.centerRight
              // ),
            ),
            SizedBox(height: 30),

            GFProgressBar(
              percentage: 0.8,
              lineHeight: 20,
              alignment: MainAxisAlignment.spaceBetween,
              child: const Text(
                '80%', 
                textAlign: TextAlign.end,
                style: TextStyle(
                  fontSize: 16, 
                  color: Colors.white
                ),
              ),
              leading: Icon(Icons.sentiment_dissatisfied, color: GFColors.DANGER),
              trailing: Icon(Icons.sentiment_satisfied, color: GFColors.SUCCESS),
              backgroundColor: Colors.black26,
              progressBarColor: GFColors.INFO,
            ),
          ],
        ),
      ),
    );
  }
}
